package com.junjie.checkin.task;

import com.junjie.checkin.mapper.ActivityMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 *  定时任务
 */

@Component
@Slf4j
public class MyTask {
    @Autowired
    private ActivityMapper activityMapper;

    /**
     * 定时检测活动是否开始
     */
    @Scheduled(cron = "0/10 * * * * ?")
    public void activeState() {
//        log.info("检测活动是否开始或者活动是否结束");
        activityMapper.judgmentBegins();
        activityMapper.modifyCheckInStatus();
        activityMapper.judgmentEnds();
    }
}
